#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
using namespace std;

const int N = 5e5 + 10, INF = 0x3f3f3f3f;

int n, idx, tt = -1;
string s;
vector<int> g[N];
int f[N][4], d[N][4];

void build(int x)
{
    int tmp = ++tt;
    if (tmp == s.length()) return;

    if (s[tmp] == '0') {
        f[x][2] = 1;
        d[x][2] = 1;
        return;
    }

    g[x].push_back(++idx);
    build(idx);

    if (s[tmp] == '2') {
        g[x].push_back(++idx);
        build(idx);
    }
}

void dfs(int x)
{
    for (auto y : g[x])
        dfs(y);

    if (g[x].size() == 1) {
        int y = g[x].back();

        f[x][1] = max(f[y][2], f[y][3]);
        f[x][2] = max(f[y][1], f[y][3]) + 1;
        f[x][3] = max(f[y][1], f[y][2]);

        d[x][1] = min(d[y][2], d[y][3]);
        d[x][2] = min(d[y][1], d[y][3]) + 1;
        d[x][3] = min(d[y][1], d[y][2]);
    } else if (g[x].size() == 2) {
        int y1 = g[x].front(), y2 = g[x].back();

        f[x][1] = max(f[y1][2] + f[y2][3], f[y1][3] + f[y2][2]);
        f[x][2] = max(f[y1][1] + f[y2][3], f[y1][3] + f[y2][1]) + 1;
        f[x][3] = max(f[y1][1] + f[y2][2], f[y1][2] + f[y2][1]);

        d[x][1] = min(d[y1][2] + d[y2][3], d[y1][3] + d[y2][2]);
        d[x][2] = min(d[y1][1] + d[y2][3], d[y1][3] + d[y2][1]) + 1;
        d[x][3] = min(d[y1][1] + d[y2][2], d[y1][2] + d[y2][1]);
    }
}

void solve()
{

    cin >> s;
    build(++idx);

    dfs(1);

    cout << max({ f[1][1],f[1][2],f[1][3] }) << ' ';
    cout << min({ d[1][1],d[1][2],d[1][3] });
}

signed main()
{
    //ios::sync_with_stdio(0);
    //cin.tie(0);cout.tie(0);
#define ONLINE_JUDGE
#ifndef ONLINE_JUDGE
    std::istringstream in(R"()");
    std::cin.rdbuf(in.rdbuf());
#endif
    int T = 1;
    //cin>>T;
    for (int i = 1;i <= T;i++) {
        solve();
    }
}